package application

import java.util.Date

import DB._
import common.Tool._
import tools.PinYin._

import scala.util.Random

/**
 * Created by 林 on 14-4-9.
 */
object DataCreate {
  def main(args: Array[String]): Unit = {

//    println(new App().createTableSql())
//    println(new UserConnect().createTableSql())
//    println(new User().createTableSql())
//    println(new Order().createTableSql())


//
//    val v=new ArticleInfo().query("id=?","66e29332914a45ac8fcf7c7608e878fc")
//    println(v.toJson)

//      println(new UserAdClick().createTableSql() + "charset=utf8mb4")
//    new User().queryAll().foreach(v=> new UserStat(v.id).insert())

//    val data=Map(
//      "aliAccessId"->"KoTJptsRMObe72O6",
//      "aliAccessKey"->"0RXv5xi1ibrf5ZHzPmNZDkepfnr0Bp",
//      "aliSearchInstance"->"handuser",
//      "aliSearchUrl"->"http://opensearch-cn-qingdao.aliyuncs.com",
//      "aliOssBucket"->"handuser",
//      "aliOssaliyunEndpoint"->"handuser.oss-cn-qingdao.aliyuncs.com",
//      "aliOssHost"->"img.handka.com",
//      "articlePath"->"/articles/"
//
//    )
//    data.map(kv=> new Setting(-1,kv._1,kv._2)).foreach(_.insert())


//    val id=new User(-1,"晓林","13028153703",0,0,"").insert()
//    val aid=new Admin(-1,id,"晓林","111111".md5,0,"*").insert()


    //    new User().createTable()
////    new Setting().createTable()
//    new ArticleLog().createTable()
//    new Article().createTable()
//    new Warn().createTable()
//    val headData=NetTool.HttpGetBin("http://wx.qlogo.cn/mmopen/ajNVdqHZLLAOtTrPkeoECLiaPoWzrKdc1RgMkZqONbQxBqhuF3ucjRrBsMcm7BKCJJUgkwm4iaVqAGQKP5d6Hu3w/0")._2
//    println(headData)
//    val tables=(new User(),new Coupons(),new UserCoupon(),new Master(),new UserAddr(),new Serve(),new ServeType(),new Order(),new PayOrder(),new Evaluate(),
//      new Message(),new UserActionLog(),new ErrorInfo(),new Setting(),new Admin(),new Role(),new RoleGroup(), new AdminModifyLog (), new Article(),new FriendlyLink())
//    transaction {
//      tables.productIterator.foreach{v=>
//        println(v)
//        v.asInstanceOf[DBEntity].deleteTable(true)
//        v.asInstanceOf[DBEntity].createTable()
//      }
//    }{v=>v.printStackTrace()}


//    new Preferential().createTable()
//    new InvitaExperience().createTable()
    //    new Prize().createTable()
    //    val ab=new DBLSInterest()
  }
//
//  def DbBand{
//    //范思哲唐纳·卡兰、Louis Vuitton、Chanel、范思哲、Dior、古奇、瓦伦蒂诺·加拉瓦尼、PRADA、GUESS、乔治·阿玛尼
//    val data=Map("Donna Karan"->"范思哲唐纳·卡兰","Louis Vuitton"->"路易威登","Chanel"->"香奈儿","Versace"->"范思哲","Dior"->"迪奥",
//      "Gucci"->"古驰","Valentino"->"瓦伦蒂诺·加拉瓦尼","PRADA"->"普拉达","GUESS"->"盖尔斯","Giorgio Armani"->"乔治·阿玛尼")
//    data.foreach{kv=>
//      new Brand(uuid,kv._1,"","",kv._2,kv._1 + ","+kv._2.pinyin+","+kv._2,0,0,new Date()).insertWithId()
//    }
//  }
//
//  def DbArea{
//    val data=Map("折扣"->true,"预售"->true,"春季"->false,"秋季"->false)
//    data.foreach{kv=>
//      new Area(uuid,kv._1,false,kv._2,100,"","").insertWithId()
//    }
//  }
//  def DbProduct{
//    val color=List("08bea60447fe41b3bb99a0fca4761624","43ba22f82b57442386c29162bf3bb859","9e00bf2aa9c44fbca2de989ccb0a9484","d9815aea96ab470dacefbdb3329985c2")
//    val bands=List("e302ee997a864076972719ea2fe42c5a","a21d3eae32134dfc9d9cb7d73a824577","a059256d669d47b9bcc281ed53fb054a","61ecb74269b24a64ae3cca4aec3c4332")
//    val data=1 to 10 map { i =>
//      new Product(uuid, "商品" + randomStr(2), "", randomStr(5), "", bands(Random.nextInt(bands.size)), color(Random.nextInt(color.size)), Random.nextInt(100000 * 100), Random.nextInt(100000 * 100), createdTime = new Date(), publishTime = new Date())
//    }
//    data.foreach{kv=>
//     kv.insertWithId()
//    }
//  }
//
//  def DbSize{
//    val data=List("IT18","XXL","国际码","h32")
//    data.foreach{kv=>
//      new Size(uuid,kv,100,"这是描述","",new Date()).insertWithId()
//    }
//  }
//
//  def DbColour{
//    val data=Map("紫色"->"#674ea7","红色"->"#ff0000","蓝色"->"#0000ff","白色"->"#ffffff")
//    data.foreach{kv=>
//      new Colour(uuid,kv._1,kv._2,"胸围:32,腰围:123,臀围123",100,"",new Date()).insertWithId()
//    }
//  }
//
//  def DbTag{
//    val data=Map("显瘦"->"#674ea7","新品"->"#ff0000","热门"->"#0000ff","顶级设计师"->"#ffffff")
//    data.foreach{kv=>
//      new Tag(uuid,kv._1,kv._2,"",100,"",new Date()).insertWithId()
//    }
//  }

}